package org.snusmumr.android.media.event;

import java.util.ArrayList;

public class ObservableImpl implements IObservable {
	private ArrayList<IObserver> list = new ArrayList<IObserver>();

	@Override
	public void register(IObserver observer) {
		if(observer != null && ! list.contains(observer))
			list.add(observer);
	}

	@Override
	public void unRegister(IObserver observer) {
		if(observer != null)
			list.remove(observer);
	}

	@Override
	public void notifyObservers(Event e) {
		for(int i=0; i<list.size(); i++)
			list.get(i).fireEvent(e);
	}

}
